package com.liu.thread.ch04;

public class T4 implements Runnable {

	
	private int ticket=10;
	
	@SuppressWarnings("static-access")
	@Override
	public void run() {
		while(true){
			if(ticket>0){
				try {
					Thread.currentThread().sleep(10);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
				System.out.println(Thread.currentThread().getName()+"售票。票号为："+ticket);
				ticket=ticket-1;
			}else{
				break;
			}
		
		}
	}
}


